using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using net_work.Data.Entity.Hmw;

namespace net_work.Config.DataBaseConfig.Hmw;

/// <summary>
/// 答案实体配置类
/// </summary>
public class BankAnswerEntityTypeConfiguration : IEntityTypeConfiguration<BankAnswer>
{
    public void Configure(EntityTypeBuilder<BankAnswer> builder)
    {
        builder.ToTable("hmw_bank_ans");

        builder.HasKey(ba => ba.Id);

        // 配置字段名映射
        builder.Property(ba => ba.Id).HasColumnName("bank_ans_id");
        builder.Property(ba => ba.Content).HasColumnName("bank_ans_cnt").IsRequired().HasMaxLength(1024);
        builder.Property(ba => ba.QuestionId).HasColumnName("bank_ques_id").IsRequired();

        builder.Property(ba => ba.CreatedBy).HasColumnName("create_by").IsRequired().HasMaxLength(64);
        builder.Property(ba => ba.CreatedTime).HasColumnName("create_time").IsRequired();
        builder.Property(ba => ba.UpdatedBy).HasColumnName("update_by").IsRequired().HasMaxLength(64);
        builder.Property(ba => ba.UpdatedTime).HasColumnName("update_time").IsRequired();
        builder.Property(ba => ba.Remark).HasColumnName("remark").HasMaxLength(256);
        builder.Property(ba => ba.DelFlag).HasColumnName("del_flag").HasDefaultValue('0');
    }
}